Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote endpoints #134

Merged
merged 1 commit into from
Mar 21, 2024
Merged

Remote endpoints #134

merged 1 commit into from
Mar 21, 2024

Conversation

chriso
Copy link
Contributor

@chriso chriso commented Mar 21, 2024

This PR reworks the Registry class so that it can be used to register and dispatch calls to functions hosted on remote endpoints.

from dispatch import Registry

remote = Registry("http://some.foreign.endpoint/")

@remote.function
def foo(bar: int) -> str: ...

You only need to register a stub for remote functions. You can then dispatch calls to them (e.g. foo.dispatch(bar)), and also use them within a local function/coroutine (e.g. await foo(bar)). Type checking works as expected in both cases.

@chriso chriso self-assigned this Mar 21, 2024
@chriso chriso merged commit 99b9ed6 into main Mar 21, 2024
3 checks passed
@chriso chriso deleted the remote-functions branch March 21, 2024 23:50
This was referenced Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants